<html>
<body>
<p id="p1">Click the button to change "Microsoft to W3Schools."</p>
<p id="demo">Microsoft is very good....</p>
<button onclick="myFunction()">Click</button>
<p id="p2"></p>

<script>
function myFunction()
{
	var x=document.getElementById("demo").innerHTML;
	var y=x.replace("Microsoft","W3Schools");
	document.getElementById("p2").innerHTML=y;
}

</script>

</body>
</html>